<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>wdpcmd</Title>
            <Shortcut>wdpcmd</Shortcut>
            <Description>wpf dependency command property</Description>
            <Author>singba</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations> 
                <Literal>
                    <ID>property</ID>
                    <ToolTip>cmmand name</ToolTip>
                    <Default>MyCommand</Default>
                </Literal>
                <Literal default="true" Editable="false">
                    <ID>ownerClass</ID>
                    <ToolTip>Owner Class</ToolTip>
                    <Function>ClassName()</Function> 
                </Literal> 
            </Declarations>
            <Code Language="csharp">
                <![CDATA[#region $property$Command DependencyProperty
			public ICommand $property$Command
            {
			    get
				{
					var value = (ICommand)GetValue($property$CommandProperty);
					if (value == null)
					{
						value = new RelayCommand(On$property$, Can$property$);
						SetValue($property$CommandProperty, value);
					}
					return value;
				}
                set { SetValue($property$CommandProperty, value); }
            }
            public static readonly DependencyProperty $property$CommandProperty = 
					DependencyProperty.Register("$property$Command", typeof(ICommand), typeof($ownerClass$), 
					new PropertyMetadata(null, new PropertyChangedCallback($ownerClass$.On$property$CommandPropertyChanged)));
					
            private static void On$property$CommandPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
            {
				if(obj is $ownerClass$)
				{
					(obj as $ownerClass$).On$property$CommandValueChanged();
				}
            }
            
			protected void On$property$CommandValueChanged()
			{
			
			}
            
            private bool Can$property$(object parameter)
            {
                return true;
            }

            private void On$property$(object parameter)
            {
				$end$
            }
			#endregion
			]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

